#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include <vector>
using namespace std;

const int N = 1e5 + 10;
int n, q;
int qo, i, j, k;
vector <int> arr[N];

int main() {
    cin >> n >> q;
    while (q--) {
        cin >> qo >> i >> j;
        if (qo == 1)
        {
            cin >> k;
            if (arr->size() <= j)
                arr->resize(j - 1);
            arr[i][j] = k;
        }
        else
            cout << arr[i][j] << endl;
    }

    return 0;

}